Modifying elements topic

After selecting elements, use the selection to modify the elements. For example, to set the class and color style of all paragraph elements in the current document:

d4
    .selectAll("p".u31)
    .attrSet("class", "graf".u22)
    .styleSet("color", "red".u22);

Selection methods typically return the current selection, or a new selection, allowing the concise application of multiple operations on a given selection via method chaining. The above is equivalent to:

final p = d4.selectAll("p".u31);
p.attrSet("class", "graf".u22);
p.styleSet("color", "red".u22);

Selections are immutable. All selection methods that affect which elements are selected (or their order) return a new selection rather than modifying the current selection. However, note that elements are necessarily mutable, as selections drive transformations of the document!

Extensions

SelectionAppend on Selection Modifying elements
SelectionAppend on Selection Modifying elements
SelectionAppend on Selection Modifying elements
SelectionAttr on Selection Modifying elements
SelectionAttr on Selection Modifying elements
SelectionAttr on Selection Modifying elements
SelectionClassed on Selection Modifying elements
SelectionClassed on Selection Modifying elements
SelectionClassed on Selection Modifying elements
SelectionClone on Selection Modifying elements
SelectionClone on Selection Modifying elements
SelectionClone on Selection Modifying elements
SelectionHtml on Selection Modifying elements
SelectionHtml on Selection Modifying elements
SelectionHtml on Selection Modifying elements
SelectionInsert on Selection Modifying elements
SelectionInsert on Selection Modifying elements
SelectionInsert on Selection Modifying elements
SelectionLower on Selection Modifying elements
SelectionLower on Selection Modifying elements
SelectionLower on Selection Modifying elements
SelectionOrder on Selection Modifying elements
SelectionOrder on Selection Modifying elements
SelectionOrder on Selection Modifying elements
SelectionProperty on Selection Modifying elements
Some HTML elements have special properties that are not addressable using attributes or styles, such as a form field’s text value and a checkbox’s checked boolean. Use this extension to get or set these properties.
SelectionProperty on Selection Modifying elements
Some HTML elements have special properties that are not addressable using attributes or styles, such as a form field’s text value and a checkbox’s checked boolean. Use this extension to get or set these properties.
SelectionProperty on Selection Modifying elements
Some HTML elements have special properties that are not addressable using attributes or styles, such as a form field’s text value and a checkbox’s checked boolean. Use this extension to get or set these properties.
SelectionRaise on Selection Modifying elements
SelectionRaise on Selection Modifying elements
SelectionRaise on Selection Modifying elements
SelectionRemove on Selection Modifying elements
SelectionRemove on Selection Modifying elements
SelectionRemove on Selection Modifying elements
SelectionSort on Selection Modifying elements
SelectionSort on Selection Modifying elements
SelectionSort on Selection Modifying elements
SelectionStyle on Selection Modifying elements
SelectionStyle on Selection Modifying elements
SelectionStyle on Selection Modifying elements
SelectionText on Selection Modifying elements
SelectionText on Selection Modifying elements
SelectionText on Selection Modifying elements

Functions

create(String name) Selection Modifying elements
Given the specified element name, returns a single-element selection containing a detached element of the given name in the current document.
create(String name) Selection Modifying elements
Given the specified element name, returns a single-element selection containing a detached element of the given name in the current document.
create(String name) Selection Modifying elements
Given the specified element name, returns a single-element selection containing a detached element of the given name in the current document.
creator(String name) → Element Function(Element, [JSAny?, int?, List<Element?>?]) Modifying elements
Given the specified element name, returns a function which creates an element of the given name, assuming that thisArg is the parent element.
creator(String name) → Element Function(Element, [JSAny?, int?, List<Element?>?]) Modifying elements
Given the specified element name, returns a function which creates an element of the given name, assuming that thisArg is the parent element.
creator(String name) → Element Function(Element, [JSAny?, int?, List<Element?>?]) Modifying elements
Given the specified element name, returns a function which creates an element of the given name, assuming that thisArg is the parent element.